import React from 'react'
import { Route } from 'react-router-dom'
import PageWithNav from 'views/msite/PageWithNav'
import IndexPage from 'views/msite/IndexPage'
import ProductsList from 'views/product/ProductsList'
import CreditCard from 'views/product/CreditCard'
import Profile from 'views/profile/Profile'

const routes = [{
  path: '/',
  component: PageWithNav,
  routes: [{
    path: '/msite',
    exact: true,
    component: IndexPage,
    isActive: true,
  }, {
    path: '/productsList',
    exact: true,
    component: ProductsList,
  }, {
    path: '/creditCard',
    exact: true,
    component: CreditCard,
  }],
}, {
  path: '/profile',
  component: Profile,
}]

const RouteWithSubRoutes = route => (
  <Route
    path={route.path}
    exact={route.exact}
    render={props => (
      <route.component {...props} routes={route.routes} />
    )}
  />
)

export {
  routes,
  RouteWithSubRoutes,
}
